/*
 * @Author: wangwei wwdqq7@qq.com
 * @Date: 2025-04-01 15:20:00
 * @LastEditors: wangwei wwdqq7@qq.com
 * @LastEditTime: 2025-04-01 17:12:41
 * @FilePath: /FullStack/pro/typeorm-mysql/src/dto/user.dto.ts
 * @Description: 用户DTO，定义用户相关请求和响应的数据结构
 */
import { ApiProperty } from '@nestjs/swagger';

export class CreateUserDto {
  @ApiProperty({
    description: '用户名',
    example: 'admin',
    required: true,
  })
  username: string;

  @ApiProperty({
    description: '密码',
    example: '123456',
    required: true,
  })
  password: string;

  @ApiProperty({
    description: '邮箱',
    example: 'admin@example.com',
    required: false,
  })
  email?: string;

  @ApiProperty({
    description: '是否激活',
    example: true,
    default: true,
    required: false,
  })
  isActive?: boolean;
}

export class UpdateUserDto {
  @ApiProperty({
    description: '用户名',
    example: 'admin',
    required: false,
  })
  username?: string;

  @ApiProperty({
    description: '密码',
    example: '123456',
    required: false,
  })
  password?: string;

  @ApiProperty({
    description: '邮箱',
    example: 'admin@example.com',
    required: false,
  })
  email?: string;

  @ApiProperty({
    description: '是否激活',
    example: true,
    required: false,
  })
  isActive?: boolean;
}

export class UserResponseDto {
  @ApiProperty({
    description: '用户ID',
    example: 1,
  })
  id: number;

  @ApiProperty({
    description: '用户名',
    example: 'admin',
  })
  username: string;

  @ApiProperty({
    description: '邮箱',
    example: 'admin@example.com',
  })
  email: string;

  @ApiProperty({
    description: '是否激活',
    example: true,
  })
  isActive: boolean;

  @ApiProperty({
    description: '创建时间',
    example: '2025-04-01T15:20:00.000Z',
  })
  createdAt: Date;

  @ApiProperty({
    description: '更新时间',
    example: '2025-04-01T15:20:00.000Z',
  })
  updatedAt: Date;
}
